<?php echo $header; ?><?php echo $column_left; ?>
<div class="feater_pro fix_right">
    <div id="content"><?php echo $content_top; ?>
      <h1><?php echo $heading_title; ?></h1>
      <b><?php echo $text_critea; ?></b>
      <div class="content">
        <p><?php echo $entry_search; ?>
          <?php if ($filter_name_blogs) { ?>
          <input type="text" name="filter_name_blogs" value="<?php echo $filter_name_blogs; ?>" />
          <?php } else { ?>
          <input type="text" name="filter_name_blogs" value="<?php echo $filter_name_blogs; ?>" onclick="this.value = '';" onkeydown="this.style.color = '000000'" style="color: #999;" />
          <?php } ?>
          <select name="filter_blogs_category_id">
            <option value="0"><?php echo $text_blogs_category; ?></option>
            <?php foreach ($categories as $category_1) { ?>
            <?php if ($category_1['blogs_category_id'] == $filter_blogs_category_id) { ?>
            <option value="<?php echo $category_1['blogs_category_id']; ?>" selected="selected"><?php echo $category_1['name']; ?></option>
            <?php } else { ?>
            <option value="<?php echo $category_1['blogs_category_id']; ?>"><?php echo $category_1['name']; ?></option>
            <?php } ?>
            <?php foreach ($category_1['children'] as $category_2) { ?>
            <?php if ($category_2['blogs_category_id'] == $filter_blogs_category_id) { ?>
            <option value="<?php echo $category_2['blogs_category_id']; ?>" selected="selected">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $category_2['name']; ?></option>
            <?php } else { ?>
            <option value="<?php echo $category_2['blogs_category_id']; ?>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $category_2['name']; ?></option>
            <?php } ?>
            <?php foreach ($category_2['children'] as $category_3) { ?>
            <?php if ($category_3['blogs_category_id'] == $filter_blogs_category_id) { ?>
            <option value="<?php echo $category_3['blogs_category_id']; ?>" selected="selected">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $category_3['name']; ?></option>
            <?php } else { ?>
            <option value="<?php echo $category_3['blogs_category_id']; ?>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $category_3['name']; ?></option>
            <?php } ?>
            <?php } ?>
            <?php } ?>
            <?php } ?>
          </select>
          <?php if ($filter_sub_blogs_category) { ?>
          <input type="checkbox" name="filter_sub_blogs_category" value="1" id="sub_blogs_category" checked="checked" />
          <?php } else { ?>
          <input type="checkbox" name="filter_sub_blogs_category" value="1" id="sub_blogs_category" />
          <?php } ?>
          <label for="sub_blogs_category"><?php echo $text_sub_blogs_category; ?></label>
        
        <?php if ($filter_description) { ?>
        <input type="checkbox" name="filter_description" value="1" id="description" checked="checked" />
        <?php } else { ?>
        <input type="checkbox" name="filter_description" value="1" id="description" />
        <?php } ?>
        <label for="description"><?php echo $entry_description; ?></label>
        <a id="button-search" class="button"><span><?php echo $button_search; ?></span></a>
      	</p>
      </div>
      <?php if ($blogs) { ?>
      <div class="product-filter">
        <div class="display"><h2><?php echo $text_search; ?></h2></div>  
        <div class="limit" style="margin-top:20px"><b><?php echo $text_limit; ?></b>
          <select onchange="location = this.value;">
            <?php foreach ($limits as $limits) { ?>
            <?php if ($limits['value'] == $limit) { ?>
            <option value="<?php echo $limits['href']; ?>" selected="selected"><?php echo $limits['text']; ?></option>
            <?php } else { ?>
            <option value="<?php echo $limits['href']; ?>"><?php echo $limits['text']; ?></option>
            <?php } ?>
            <?php } ?>
          </select>
        </div>
      </div> 
 
        <?php foreach ($blogs as $blogs_item) { ?>
          <div class="ttgt">
              <?php if ($blogs_item['thumb']) { ?>
                <a href="<?php echo $blogs_item['href']; ?>"><img src="<?php echo $blogs_item['thumb']; ?>" title="<?php echo $blogs_item['name']; ?>" alt="<?php echo $blogs_item['name']; ?>" <?php echo $blogs_item['width']; ?> <?php echo $blogs_item['height']; ?> /></a>
              <?php } ?>
              <p><a href="<?php echo $blogs_item['href']; ?>"><?php echo $blogs_item['name']; ?></a></p>
              <p class="description"><?php echo $blogs_item['short_description']; ?></p>
          </div>
        <?php } ?>
      
      <div class="pagination"><?php echo $pagination; ?></div>
      <?php } else { ?>
      <div class="content"><?php echo $text_empty; ?></div>
      <?php }?>
      <?php echo $content_bottom; ?></div>
    <script type="text/javascript"><!--
    $('#content input[name=\'filter_name_blogs\']').keydown(function(e) {
        if (e.keyCode == 13) {
            $('#button-search').trigger('click');
        }
    });
    
    $('#button-search').bind('click', function() {
        url = 'index.php?route=blogs/search';
        var filter_name_blogs = $('#content input[name=\'filter_name_blogs\']').attr('value');
        
        if (filter_name_blogs) {
            url += '&filter_name_blogs=' + encodeURIComponent(filter_name_blogs);
        }
    
        var filter_blogs_category_id = $('#content select[name=\'filter_blogs_category_id\']').attr('value');
        
        if (filter_blogs_category_id > 0) {
            url += '&filter_blogs_category_id=' + encodeURIComponent(filter_blogs_category_id);
        }
        
        var filter_sub_blogs_category = $('#content input[name=\'filter_sub_blogs_category\']:checked').attr('value');
        
        if (filter_sub_blogs_category) {
            url += '&filter_sub_blogs_category=true';
        }
            
        var filter_description = $('#content input[name=\'filter_description\']:checked').attr('value');
        
        if (filter_description) {
            url += '&filter_description=true';
        }
    
        location = url;
    });
    
    //--></script> 
 </div>
<?php echo $footer; ?>